import http from '../../../util/http.js';



//获取部门列表树
export function deptTree() {
	let url = `/hrms/dept/tree`;
	return new Promise((resolve, reject) => {
		http.get(url).then(response => {
			resolve(response)
		});
	});
}






//新增部门
export function deptAdd(param) {
	let url = `/hrms/dept/add`;
	return new Promise((resolve, reject) => {
		http.post(url, param).then(response => {
			resolve(response)
		})
	});
}


//根据职务编号ID修改部门
export function deptUpdate(id,param) {
	let url = `/hrms/dept/update/${id}`;
	return new Promise((resolve, reject) => {
		http.put(url, param).then(response => {
			resolve(response)
		})
	});
}


 //根据部门编号删除部门
 export function deptDel(id) {
 	let url = `/hrms/dept/delete/${id}`;
 	return new Promise((resolve, reject) => {
 		http.delete(url).then(response => {
 			resolve(response)
 		})
 	});
 }



 //============================




//获取职务列表
export function positionList(pagination, param) {
	let url = `/hrms/position/list/${pagination.pageSize}/${pagination.current}`;
	return new Promise((resolve, reject) => {
		http.get(url, param).then(response => {
			resolve(response)
		});
	});
}

//新增职务
export function positionAdd(param) {
	let url = `/hrms/position/add`;
	return new Promise((resolve, reject) => {
		http.post(url, param).then(response => {
			resolve(response)
		})
	});
}


//根据职务编号ID修改职务
export function positionUpdate(id,param) {
	let url = `/hrms/position/update/${id}`;
	return new Promise((resolve, reject) => {
		http.put(url, param).then(response => {
			resolve(response)
		})
	});
}


//根据职务编号删除职务
export function positionDel(id) {
	let url = `/hrms/position/delete/${id}`;
	return new Promise((resolve, reject) => {
		http.delete(url).then(response => {
			resolve(response)
		})
	});
}






//================分组方法==================

//获取分组列表
export function groupList(pagination, param) {
	let url = `/hrms/group/list/${pagination.pageSize}/${pagination.current}`;
	return new Promise((resolve, reject) => {
		http.get(url, param).then(response => {
			resolve(response)
		});
	});
}

//新增职务
export function groupAdd(param) {
	let url = `/hrms/group/add`;
	return new Promise((resolve, reject) => {
		http.post(url, param).then(response => {
			resolve(response)
		})
	});
}


//根据分组编号ID修改分组
export function groupUpdate(id,param) {
	let url = `/hrms/group/update/${id}`;
	return new Promise((resolve, reject) => {
		http.put(url, param).then(response => {
			resolve(response)
		})
	});
}


//根据分组编号删除分组
export function groupDel(id) {
	let url = `/hrms/group/delete/${id}`;
	return new Promise((resolve, reject) => {
		http.delete(url).then(response => {
			resolve(response)
		})
	});
}





//===============人员管理=============





//获取人员列表
export function staffList(pagination, param) {
	let url = `/hrms/staff/list/${pagination.pageSize}/${pagination.current}`;
	return new Promise((resolve, reject) => {
		http.get(url, param).then(response => {
			resolve(response)
		});
	});
}

//新增人员
export function staffAdd(param) {
	let url = `/hrms/staff/add`;
	return new Promise((resolve, reject) => {
		http.post(url, param).then(response => {
			resolve(response)
		})
	});
}


//根据人员ID修改人员
export function staffUpdate(id,param) {
	let url = `/hrms/staff/update/${id}`;
	return new Promise((resolve, reject) => {
		http.put(url, param).then(response => {
			resolve(response)
		})
	});
}


//根据人员ID删除人员
export function delStaff(id) {
	let url = `/hrms/staff/delete/${id}`;
	return new Promise((resolve, reject) => {
		http.delete(url).then(response => {
			resolve(response)
		})
	});
}









//根据人员代码保存人员标签
export function getStaffGroup(staffCode) {
	let url = `/hrms/staff/group/list/${staffCode}`;
	return new Promise((resolve, reject) => {
		http.get(url).then(response => {
			resolve(response)
		})
	});
}





//根据人员代码保存人员标签
export function saveStaffGroup(staffCode,param) {
	let url = `/hrms/staff/group/save/${staffCode}`;
	return new Promise((resolve, reject) => {
		http.post(url, param).then(response => {
			resolve(response)
		})
	});
}





//根据人员代码获取人员指纹
export function getStaffFinger(staffCode) {
	let url = `/hrms/staff/finger/list/${staffCode}`;
	return new Promise((resolve, reject) => {
		http.get(url).then(response => {
			resolve(response)
		})
	});
}





//根据人员代码保存人员指纹
export function saveStaffFinger(postData) {
	let url = `/hrms/staff/fingers/add`;
	return new Promise((resolve, reject) => {
		http.post(url,postData).then(response => {
			resolve(response)
		})
	});
}



//根据人员ID删除人员
export function delStaffFinger(fingerId) {
	let url = `/hrms/staff/finger/delete/${fingerId}`;
	return new Promise((resolve, reject) => {
		http.delete(url).then(response => {
			resolve(response)
		})
	});
}








